<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui">


    <ui:define name="content">

        <h:panelGroup >
            <h:form  >
                <p:growl />
                <p:focus id="selectFocus" context="gpSelect" />
                <p:focus id="detailFocus" context="gpDetail" />



                <p:panel header="Manage Paysheet Component" >
                    <h:panelGrid id ="gpVeda" columns="2" styleClass="alignTop">

                        <h:panelGrid id="gpSelect" columns="1"  >
                            <p:panel >
                                <h:panelGrid id="gpSelectText" >
                                    <p:selectOneListbox  id="lstSelect"  value="#{paysheetComponentSystemController.current}" style="min-width: 223px;height: 300px;">
                                        <f:selectItems  value="#{paysheetComponentSystemController.items}" var="myItem" itemValue="#{myItem}" itemLabel="#{myItem.name}" ></f:selectItems>
                                        <f:ajax render="gpDetail" execute="lstSelect" >
                                        </f:ajax>
                                    </p:selectOneListbox>
                                </h:panelGrid>
                                <h:panelGrid id="gpSelectButtons" columns="3"  >
                                    <p:commandButton id="btnAdd" ajax="false" value="Add" action="#{paysheetComponentSystemController.prepareAdd()}" styleClass="buttons" onclick="onSubmitButton();" >
                                        <f:ajax render="btnAdd  btnDelete btnSave   lstSelect gpDetail detailFocus" execute="" >
                                        </f:ajax>
                                    </p:commandButton>
                                    <p:commandButton id="btnDelete" ajax="false" onclick="if (!confirm('Are you sure you want to delete this record?'))
                                                return false;" action="#{paysheetComponentSystemController.delete()}"  value="Delete"  >
                                    </p:commandButton>
                                </h:panelGrid>
                            </p:panel>
                        </h:panelGrid  >

                        <p:panel>
                            <h:panelGrid id="gpDetail" columns="1">
                                <h:panelGrid id="gpDetailText" columns="2">
                                    <h:outputText value="Name#{paysheetComponentSystemController.current.id}" ></h:outputText>
                                    <p:inputText autocomplete="off" value="#{paysheetComponentSystemController.current.name}"  />                              
                                    <h:outputText value="Order No" ></h:outputText>
                                    <p:inputText autocomplete="off" value="#{paysheetComponentSystemController.current.orderNo}"  />                              
                                    <p:outputLabel value="Component Type "/>
                                    <p:selectOneMenu value="#{paysheetComponentSystemController.current.componentType}">
                                        <f:selectItem itemLabel="Please select component Type "/>
                                        <f:selectItems value="#{enumController.paysheetComponentTypesSystemDefinded}"/>
                                    </p:selectOneMenu>  

                                    <h:outputText value="Included For EPF" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includedForEpf}" />
                                    <h:outputText value="Included For ETF" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includedForEtf}" />
                                    <h:outputText value="Included For PayTax" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includedForPayTax}" />
                                    <h:outputText value="Included For OT" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includedForOt}" />
                                    <h:outputText value="Included For No Pay" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includedForNoPay}" />
                                    <h:outputText value="Included For PH" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includedForPh}" />
                                       <h:outputText value="Included For Allowances(For Dayment in PH and Dayoff)" ></h:outputText>
                                    <p:selectBooleanCheckbox value="#{paysheetComponentSystemController.current.includeForAllowance}" />
                                </h:panelGrid>
                                <h:panelGrid id="gpDetailButtons" columns="2">
                                    <p:commandButton id="btnSave" ajax="false" value="Save" action="#{paysheetComponentSystemController.saveSelected()}" styleClass="buttons" onclick="onSubmitButton();">
                                        <f:ajax render="btnAdd  btnDelete btnSave   lstSelect gpDetail selectFocus"  execute="gpDetail" >
                                        </f:ajax>
                                    </p:commandButton>
                                    <p:defaultCommand target="btnSave"/>
                                </h:panelGrid>
                            </h:panelGrid>
                        </p:panel>
                    </h:panelGrid>
                </p:panel>
            </h:form>

        </h:panelGroup>

    </ui:define>

</ui:composition>
